function index(tbl){
	var pid="";
	if(user()==null){
		return "/login?goto=/manage/";
	}else{
		if(user().agency_id==0){
			return "/agency/apply";
		}
	}
	
	if(tbl.pid!=undefined){
		pid=tbl.pid
	}
	var iframesrc="main";
	var menus=$list("menu",Cnd.where("pid","=",0));
	menus.forEach(function(m){
		if(pid==m.id){
			iframesrc=m.url
		}
		var groups=$list("menu",Cnd.where("pid","=",m.id))
		groups.forEach(function(g){
			g.put("list",$list("menu",Cnd.where("pid","=",g.id)))
		})
		m.put("groups",groups)
	})
	attr("menus",menus)
	attr("iframesrc",iframesrc)
}
function main(tbl){//首页
	
}
function course(tbl){//课程
	var cnd=Cnd.where("1","=",1)
	if(!isEmpty(tbl.price)){
		cnd.and("price",tbl.price,0)
	}
	var courses=$list("course",cnd.desc("id"),1,10)
	return courses;
}
function exam(tbl){//习题
	
}
function datum(tbl){
	
}